<#assign  title="我的订单" />
<#include 'member_header.html' />
<!-- 获取会员订单列表标签 -->
<#assign memberOrderListTag = newTag("memberOrderListTag")>

<!-- 调用会员订单列表标签 -->
<#assign memberOrderList = memberOrderListTag("{'keyword':'${keyword!''}'}")>
<#assign order = memberOrderList.ordersList>
<#assign orderstatus= "com.enation.app.shop.core.taglib.OrderStatusDirectiveModel"?new()>
<!-- 获取订单状态标签 -->
<#assign orderStautsTag = newTag("orderStautsTag")>
<!-- 调用订单状态标签 -->
<#assign orderState = orderStautsTag()>
<script src="${ctx}/themes/default/js/Order.js" type="text/javascript"></script>

<div class="data">
	<h2>我的订单</h2>
</div>	 
<!--温馨提示-->
<div class="tip" >
	<div class="top"></div>
	<div class="body">
		<@image src="${ctx}/themes/default/images/gth.jpg" />
		<div>
			<h2>温馨提示</h2>
			<p>1、这里会显示您更多的订单</p>
			<p>2、您还可以进行查看订单详情、搜索已成功订单和取消订单等操作。</p>
		</div>
	</div>
	<div class="bottom"></div>
</div>
<!--温馨提示结束-->
<div id="search_wrapper">
	<div class="tip">
	<div class="top"></div>
		<div class="body">
		<table>
			<tr>
				<td class="label">搜索订单：</td>
				<td class="input"><input class="inputText default" id="search_keyword" autocomplete="off" type="text" placeholder="输入订单中商品关键词" value="${keyword!''}"/></td>
				<td class="search"><input class="searOrderBtn" id="btnSearch" type="button" value="在订单中搜索"/></td>
				<td id="searchR">搜索结果：<strong><#if keyword??>${memberOrderList.totalCount!0}<#else>0</#if></strong>笔订单</td>
			</tr>
		</table>
		</div>
	<div class="bottom"></div>
	</div>							
</div>		
<div class="tab">
	<ul>
		<li <#if !memberOrderList.status?exists  && !memberOrderList.keyword?exists >class="selected"</#if>><a href="order.html"><span>所有订单</span></a></li>						
		<li <#if memberOrderList.status?exists && memberOrderList.status == memberOrderList.ORDER_NOT_PAY>class="selected"</#if>><a href="order.html?status=0"><span>等待付款</span></a></li>
		<li <#if memberOrderList.status?exists && memberOrderList.status == memberOrderList.ORDER_PAY>class="selected"</#if>><a href="order.html?status=1"><span>已付款待确认</span></a></li>
		<li <#if memberOrderList.status?exists && memberOrderList.status == memberOrderList.ORDER_PAY_CONFIRM>class="selected"</#if>><a href="order.html?status=2"><span>已付款</span></a></li>
		<!-- <li <#if memberOrderList.status?exists && memberOrderList.status == memberOrderList.ORDER_ALLOCATION>class="selected"</#if>><a href="order.html?status=3"><span>配货中</span></a></li> -->
		<li <#if memberOrderList.status?exists && memberOrderList.status == memberOrderList.ORDER_SHIP>class="selected"</#if>><a href="order.html?status=5"><span>已发货</span></a></li>
		<li <#if memberOrderList.status?exists && memberOrderList.status == memberOrderList.ORDER_CANCELLATION>class="selected"</#if>><a href="order.html?status=8"><span>已取消</span></a></li>
		<li <#if memberOrderList.status?exists && memberOrderList.status == memberOrderList.ORDER_COMPLETE>class="selected"</#if>><a href="order.html?status=7"><span>已成功</span></a></li>
		<li <#if keyword?exists>class="selected"</#if>><a href="javascript:;" id="searchtab" onclick="$('#btnSearch').click()"><span>搜索结果</span></a></li>
	</ul>
</div>
<div class="box">				
	<div class="top"></div>
	<div class="body" >
	<#if order?size gt 0 >
		<table cellspacing="0" cellpadding="0" width="100%" >
			<thead>
				<tr>	 
					<th>订单号</th>
					<th>下单日期</th>
					<th>收货人</th>
					<th>总金额</th>
					<th>状态</th>
					<th>付款方式</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody  >
				<#list order as orders>
					<tr>
						<td><a href="order_detail.html?ordersn=${orders.sn}">${orders.sn!'' }</a></td>
						<td><@dateformat time="${orders.create_time?c}" pattern="yyyy-MM-dd HH:mm"/></td>
						<td>${orders.ship_name!'' }</td>
						<td class="textright">${orders.order_amount?string.currency}</td>
						<td><@orderstatus status="${orders.status}" type="order" /></td>
						<td>${orders.payment_name}</td>
						<td class="oper"> 
							<span>
							
								<#if orders.status == orderState.ORDER_NOT_PAY>
									<#if orders.isOnlinePay  >
										<a href="${ctx}/api/shop/payment.do?orderid=${orders.order_id}" class="green_btn">立即付款</a>
									</#if>	
									<#if orders.status==orderState.ORDER_NOT_PAY>
										<a href='javascript:;' class="cancelBtn" sn="${orders.sn}" rel="${orders.order_id}" >取消订单</a>
									</#if>
								<#elseif orders.status == orderState.ORDER_SHIP >
									<a href="javascript:;"   class="rogBtn" orderid="${orders.order_id}">确认收货</a>
									
								</#if>
								
								<#if orders.status == orderState.ORDER_SHIP ||  orders.status == orderState.ORDER_ROG ||   orders.status == orderState.ORDER_COMPLETE> 
								<a href="return.html?order_id=${orders.order_id}"  class="" >退货</a>
								</#if>
							</span>
							
							<span ><a class="check" href="order_detail.html?ordersn=${orders.sn}" >查看</a></span>
							
						</td>
					</tr>
				</#list>
			</tbody>
		</table>
		<div class="pager_border">
			<@pager pageno="${memberOrderList.page}" pagesize="${memberOrderList.pageSize}" totalcount="${memberOrderList.totalCount}" />
			<div class="clear"></div>
		</div>
		<#else>
		<div class="empty" >尚无订单</div>
		</#if>
	</div>
	<div class="bottom"></div>
</div>
<div class="clear"></div>
<div class="helper">
	<h2>小贴士</h2>
	<ul>
		<li><a href="help-25-12.html" target="_blank">1、订单状态说明？</a></li>
		<li><a href="help-25-33.html" target="_blank">2、哪里可以查询到我的订单的详细动态？</a></li>
	</ul>
</div>
<!-- 浮动窗口 取消订单 -->
<#include 'order_cancel.html'/>
<script>
var ordersearchTipText = "输入订单中商品关键词";
function odersearch(){
	var orderkeyword = $.trim($("#search_keyword").val());
	if(orderkeyword == ordersearchTipText){
		orderkeyword = '';
	}
	if(orderkeyword==''){
		alert("请输入订单中商品关键词！");
	}else{
		location.href="order.html?keyword=" + orderkeyword;
	}
}
$(function(){	
	$("#search_keyword").keypress(function(event){
		$("#search_keyword").attr("class","inputText");
		if(event.keyCode=="13" ){
			odersearch();
		}
	});
	$("#search_keyword").click(function(){
		if($(this).val() == ordersearchTipText){
			$(this).val("");
		}
	});
	$("#search_keyword").blur(function(){
		if($(this).val() == ''){
			$(this).val(ordersearchTipText);
		}
	});
	
	$("#btnSearch").click(function(){
		odersearch();
	});
	Order.init();	
});
</script>
	<!--会员中心首页右侧结束-->
</div>

	<div class="rr_bottom"></div>

</div>
</div>
<#include '../common/footer.html'/>
		